asm
  ld sp,$8FFF
  end asm

#include "./library/smsrnd.bas"
#include "./library/smsdelay.bas"

dim eee as uinteger at $8010
dim seed as uinteger at $8012
dim ee0 as uinteger at $8014
dim ee1 as uinteger at $8016
dim ee2 as uinteger at $8018
dim ee3 as uinteger at $801A
dim eex as uinteger at $801C
dim eey as uinteger at $801E

seed=0

sub ddayputchar(txp1 as uinteger,typ1 as uinteger,tch1 as ubyte,tly1 as uinteger):
  poke $9400+tly1*$400+(txp1 bxor 31)*32+typ1,tch1
  end sub

for ee0=0 to 31
  for ee1=2 to 29
    seed=smsrnd(seed)
    'ddayputchar(ee1,ee0,seed band $01,0)
    ddayputchar(ee1,ee0,96+(seed mod 9),0)
    seed=smsrnd(seed)
    ddayputchar(ee1,ee0,seed band $01,1)
    seed=smsrnd(seed)
    ddayputchar(ee1,ee0,seed band $FF,2)
    smsdelay(1000)
    next:next

for ee0=0 to 15
  for ee1=0 to 15
    seed=smsrnd(seed)
    ddayputchar(ee1+13,ee0+13,ee0*16+ee1,0)
    ddayputchar(ee1+13,ee0+13,0,1)
    ddayputchar(ee1+13,ee0+13,0,2)
    smsdelay(1000)
    next:next

eee=0:eex=8:eey=8
do

ddayputchar(3,3,48+(int(eee/100) mod 10),0)
ddayputchar(4,3,48+(int(eee/10) mod 10),0)
ddayputchar(5,3,48+(eee mod 10),0)

ee0=peek($F000)
ddayputchar(3,5,48+(int(ee0/100) mod 10),0)
ddayputchar(4,5,48+(int(ee0/10) mod 10),0)
ddayputchar(5,5,48+(ee0 mod 10),0)

eey=eey-((ee0 band 1)/1)+((ee0 band 2)/2)
eex=eex+((ee0 band 4)/4)-((ee0 band 8)/8)

ee0=peek($F100)
ddayputchar(3,6,48+(int(ee0/100) mod 10),0)
ddayputchar(4,6,48+(int(ee0/10) mod 10),0)
ddayputchar(5,6,48+(ee0 mod 10),0)

ee0=peek($F180)
ddayputchar(3,7,48+(int(ee0/100) mod 10),0)
ddayputchar(4,7,48+(int(ee0/10) mod 10),0)
ddayputchar(5,7,48+(ee0 mod 10),0)

ee0=peek($F200)
ddayputchar(3,8,48+(int(ee0/100) mod 10),0)
ddayputchar(4,8,48+(int(ee0/10) mod 10),0)
ddayputchar(5,8,48+(ee0 mod 10),0)


ddayputchar(eex,eey,eee mod 96,0)

eee=eee+1
smsdelay(1000)
loop

do:loop

'-------------------------------

do

for ee0=0 to 31
  for ee1=2 to 29
    seed=smsrnd(seed)
    ddayputchar(ee1,ee0,seed,0)
    seed=smsrnd(seed)
    ddayputchar(ee1,ee0,seed,1)
    seed=smsrnd(seed)
    ddayputchar(ee1,ee0,seed,2)
    smsdelay(1000)
    next:next

loop

do:loop

do


for ee2=$9400 to $97FF '-video
  seed=smsrnd(seed)
  poke ee2,seed
  smsdelay(5000)
  next

for ee2=$9C00 to $9FFF  '-bg2
  seed=smsrnd(seed)
  poke ee2,seed
  smsdelay(5000)
  next

for ee2=$9800 to $9BFF  '-bg1
  seed=smsrnd(seed)
  poke ee2,seed
  smsdelay(5000)
  next

for ee2=$9000 to $93FF '-sprite
  seed=smsrnd(seed)
  poke ee2,seed
  smsdelay(5000)
  next

loop

do:loop


'static ADDRESS_MAP_START( main_cpu, AS_PROGRAM, 8, ddayjlc_state )
'	AM_RANGE(0x0000, 0x7fff) AM_ROM
'	AM_RANGE(0x8000, 0x8fff) AM_RAM AM_SHARE("mainram")
'	AM_RANGE(0x9000, 0x93ff) AM_RAM AM_SHARE("spriteram")
'	AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(ddayjlc_videoram_w) AM_SHARE("videoram")
'	AM_RANGE(0x9800, 0x9fff) AM_RAM_WRITE(ddayjlc_bgram_w) AM_SHARE("bgram") /* 9800-981f - videoregs */
'	AM_RANGE(0xa000, 0xdfff) AM_ROMBANK("bank1") AM_WRITENOP
'	AM_RANGE(0xe000, 0xe003) AM_WRITE(i8257_CH0_w)
'	AM_RANGE(0xe008, 0xe008) AM_WRITENOP
'	AM_RANGE(0xf000, 0xf000) AM_WRITE(sound_w)
'	AM_RANGE(0xf100, 0xf100) AM_WRITENOP
'	AM_RANGE(0xf080, 0xf080) AM_WRITE(char_bank_w)
'	AM_RANGE(0xf081, 0xf081) AM_WRITENOP
'	AM_RANGE(0xf083, 0xf083) AM_WRITE(i8257_LMSR_w)
'	AM_RANGE(0xf084, 0xf084) AM_WRITE(bg0_w)
'	AM_RANGE(0xf085, 0xf085) AM_WRITE(bg1_w)
'	AM_RANGE(0xf086, 0xf086) AM_WRITE(bg2_w)
'	AM_RANGE(0xf101, 0xf101) AM_WRITE(main_nmi_w)
'	AM_RANGE(0xf102, 0xf105) AM_WRITE(prot_w)
'	AM_RANGE(0xf000, 0xf000) AM_READ_PORT("INPUTS")
'	AM_RANGE(0xf100, 0xf100) AM_READ_PORT("SYSTEM")
'	AM_RANGE(0xf180, 0xf180) AM_READ_PORT("DSW1")
'	AM_RANGE(0xf200, 0xf200) AM_READ_PORT("DSW2")
'ADDRESS_MAP_END


